package vip.specimen.system.datasource.entity;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import vip.specimen.system.common.enums.SaveMethodEnum;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * *@Author: 余浪人
 * *@Date：2021/3/11 14:03
 * *@Email:yulangren520@Gmail.com
 * *@QQ:1368419640
 **/
@Setter
@Getter
@Entity
@Table(name = "system_resource")
public class SystemResourceEntity extends BaseEntity {
    @Column(unique = true)
    @ApiModelProperty(value = "资源名称")
    private String fileName;
    @ApiModelProperty(value = "资源大小", dataType = "long")
    private long fileSize;
    @ApiModelProperty(value = "原始资源名称")
    private String originalName;
    @ApiModelProperty(value = "资源位置(url)")
    private String fileResourceUrl;
    @ApiModelProperty(value = "资源类型")
    private String fileContentType;
    @ManyToOne
    @ApiModelProperty(value = "资源后缀")
    private SystemResourceSuffixEntity suffixEntity;
    @ApiModelProperty(value = "存储方式", dataType = "SaveMethodEnum")
    private SaveMethodEnum saveMethodEnum;
    @ApiModelProperty(value = "资源Key(唯一标识)")
    private String fileKey;

    public SystemResourceEntity() {
    }

    public SystemResourceEntity(String fileName, long fileSize, String originalName, String fileResourceUrl, String fileContentType, SystemResourceSuffixEntity suffixEntity, SaveMethodEnum saveMethodEnum, String fileKey) {
        this.fileName = fileName;
        this.fileSize = fileSize;
        this.originalName = originalName;
        this.fileResourceUrl = fileResourceUrl;
        this.fileContentType = fileContentType;
        this.suffixEntity = suffixEntity;
        this.saveMethodEnum = saveMethodEnum;
        this.fileKey = fileKey;
    }
}
